KeyEvent

public interface KeyEvent implements UiEventModifier

A keyboard event that provides access to the keyboard event data.

This event occurs when a user performs some keyboard action. For example, presses or releases a keyboard key.

Functions

Link copied to clipboard
public abstract String character()
Returns a UTF-8 character associated with the physical key, if it has a printed representation.
Link copied to clipboard
public abstract Optional<EventTarget> currentTarget()
Returns an Optional that contains the event target that represents the element to which the event handler has been attached, otherwise an empty Optional.
Link copied to clipboard
public abstract DomKeyCode domKeyCode()
Returns the code of the physical key used in the event.
Link copied to clipboard
public abstract boolean isBubbles()
Returns true if the event bubbles up through the DOM, otherwise false.
Link copied to clipboard
public abstract boolean isCancelable()
Returns true when the event can be canceled, and therefore prevented as if the event never happened.
Link copied to clipboard
public abstract boolean isTrusted()
Returns true if the event is trusted, and therefore was generated by a user action.
Link copied to clipboard
public abstract KeyModifiers keyModifiers()
Returns the key modifiers that are applied to the event.
Link copied to clipboard
public abstract EventPhase phase()
Returns the event phase.
Link copied to clipboard
public abstract void preventDefault()
Informs the browser that if the event is not explicitly handled, its default action should not be performed.
Link copied to clipboard
public abstract void stopPropagation()
Informs the browser that the event should not propagate in the capturing and bubbling phases.
Link copied to clipboard
public abstract Optional<EventTarget> target()
Returns an Optional that contains the element on which the event occurred if it exists, otherwise an empty Optional.
Link copied to clipboard
public abstract EventType type()
Returns the event type.